package com.yhb.dao;

import com.yhb.model.VipFlow;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface UserVipFlowMapper {
    VipFlow isVipInTime(@Param("userId") String userId,
                        @Param("type") Type type,
                        @Param("subType") SubType subType,
                        @Param("time") Date time);

    VipFlow latestInvalidVipFlow(@Param("userId") String userId,
                                 @Param("type") Type type,
                                 @Param("subType") SubType subType);

    int insertFlow(@Param("userId") String userId,
                   @Param("type") Type type,
                   @Param("subType") SubType subType,
                   @Param("startTime") Date startTime,
                   @Param("endTime") Date endTime);

    VipFlow isOccurTimeInRange(@Param("userId") String userId,
                            @Param("type") Type type,
                            @Param("subType") SubType subType,
                            @Param("startTime") Date startTime,
                            @Param("endTime") Date endTime);

    enum Type {
        PAYED,
        PRIME
    }

    enum SubType {
        TEMP, // 试用, 奖励等发放用
        PERMANENT // 永久
    }
}
